home *** CD-ROM | disk | FTP | other *** search
/ Programming in Microsoft Windows with C# / Programacion en Microsoft Windows con C#.iso / Codigo / Vista en árbol y vista en lista / SplitThreeAcross / SplitThreeAcross.cs next >
Encoding:
Text File  |  2002-05-22  |  2.0 KB  |  64 lines

  1. //-----------------------------------------------
  2. // SplitThreeAcross.cs ⌐ 2001 by Charles Petzold
  3. //-----------------------------------------------
  4. using System;
  5. using System.Drawing;
  6. using System.Windows.Forms;
  7.  
  8. class SplitThreeAcross: Form
  9. {
  10.      public static void Main()
  11.      {
  12.           Application.Run(new SplitThreeAcross());
  13.      }
  14.      public SplitThreeAcross()
  15.      {
  16.           Text = "Divisi≤n en tres";
  17.  
  18.           Panel panel1     = new Panel();
  19.           panel1.Parent    = this;
  20.           panel1.Dock      = DockStyle.Fill;
  21.           panel1.BackColor = Color.Cyan;
  22.           panel1.Resize   += new EventHandler(PanelOnResize);
  23.           panel1.Paint    += new PaintEventHandler(PanelOnPaint);
  24.  
  25.           Splitter split1  = new Splitter();
  26.           split1.Parent    = this;
  27.           split1.Dock      = DockStyle.Left;
  28.  
  29.           Panel panel2     = new Panel();
  30.           panel2.Parent    = this;
  31.           panel2.Dock      = DockStyle.Left;
  32.           panel2.BackColor = Color.Lime;
  33.           panel2.Resize   += new EventHandler(PanelOnResize);
  34.           panel2.Paint    += new PaintEventHandler(PanelOnPaint);
  35.  
  36.           Splitter split2  = new Splitter();
  37.           split2.Parent    = this;
  38.           split2.Dock      = DockStyle.Right;
  39.  
  40.           Panel panel3     = new Panel();
  41.           panel3.Parent    = this;
  42.           panel3.Dock      = DockStyle.Right;
  43.           panel3.BackColor = Color.Red;
  44.           panel3.Resize   += new EventHandler(PanelOnResize);
  45.           panel3.Paint    += new PaintEventHandler(PanelOnPaint);
  46.  
  47.           panel1.Width = 
  48.           panel2.Width = 
  49.           panel3.Width = ClientSize.Width / 3;
  50.      }
  51.      void PanelOnResize(object obj, EventArgs ea)
  52.      {
  53.           ((Panel) obj).Invalidate();
  54.      }
  55.      void PanelOnPaint(object obj, PaintEventArgs pea)
  56.      {
  57.           Panel    panel = (Panel) obj;
  58.           Graphics grfx  = pea.Graphics;
  59.  
  60.           grfx.DrawEllipse(Pens.Black, 0, 0, 
  61.                            panel.Width - 1, panel.Height - 1);
  62.      }
  63. }
  64.